import Vue from 'vue'
import VueRouter from 'vue-router'
import {
  routes
} from './routers'

Vue.use(VueRouter)

//解决跳转错误
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location, onResolve, onReject) {
  undefined
  if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject)
  return originalPush.call(this, location).catch(err => err)
}

const router = new VueRouter({
  //浏览器历史模式，需要关闭
  // mode:'history',
  routes
})

export default router